package org.itboys.weixin.entity;

/**
 * 微信企业付款配置
 * @author weisky
 *
 * 2016年4月27日
 */
public class CompanyPayConfig {

	private String mchAppId;//公众账号appid 必填
	private String mchId;//商户号  必填
	private String nonceStr;//随机字符串 必填
	private String sign;//签名  必填
	private String partnerTradeNo;//商户订单号 必填
	private String openId;//用户openid 必填
	private String checkName = "NO_CHECK";//校验用户姓名选项  NO_CHECK：不校验真实姓名   FORCE_CHECK：强校验真实姓名（未实名认证的用户会校验失败，无法转账）  OPTION_CHECK：针对已实名认证的用户才校验真实姓名（未实名认证用户不校验，可以转账成功）
	private int amount;//企业付款金额，单位为分 必填
	private String desc;//企业付款描述信息 必填
	private String spbillCreateIp;//Ip地址 必填
	private String key;
	
	/**
	 * 按照参数名ASCII字典序排序
	 * @return
	 */
	public String sort(){
		return "amount="+getAmount()+"&check_name=NO_CHECK&desc="+getDesc()
				+ "&mch_appid="+getMchAppId()+"&mchid="+getMchId()+"&nonce_str="+getNonceStr()
				+ "&openid="+getOpenId()+"&partner_trade_no="+getPartnerTradeNo()
				+ "&spbill_create_ip="+getSpbillCreateIp()
				+ "&key="+getKey();
	}
	
	
	/**
	 * 拼接成xml格式
	 * @return
	 */
	public String getXml(){
		return "<xml>"+
					"<amount>"+getAmount()+"</amount>"+
					"<check_name>NO_CHECK</check_name>"+
					"<desc>"+getDesc()+"</desc>"+
					"<mch_appid>"+getMchAppId()+"</mch_appid>"+
					"<mchid>"+getMchId()+"</mchid>"+
					"<nonce_str>"+getNonceStr()+"</nonce_str>"+
					"<openid>"+getOpenId()+"</openid>"+
					"<partner_trade_no>"+getPartnerTradeNo()+"</partner_trade_no>"+
					"<spbill_create_ip>"+getSpbillCreateIp()+"</spbill_create_ip>"+
					"<sign>"+getSign()+"</sign>"+
				"</xml>";
	}
	
	
	public String getKey() {
		return key;
	}

	public void setKey(String key) {
		this.key = key;
	}

	public String getMchAppId() {
		return mchAppId;
	}
	public void setMchAppId(String mchAppId) {
		this.mchAppId = mchAppId;
	}
	public String getMchId() {
		return mchId;
	}
	public void setMchId(String mchId) {
		this.mchId = mchId;
	}
	public String getNonceStr() {
		return nonceStr;
	}
	public void setNonceStr(String nonceStr) {
		this.nonceStr = nonceStr;
	}
	public String getSign() {
		return sign;
	}
	public void setSign(String sign) {
		this.sign = sign;
	}
	public String getPartnerTradeNo() {
		return partnerTradeNo;
	}
	public void setPartnerTradeNo(String partnerTradeNo) {
		this.partnerTradeNo = partnerTradeNo;
	}
	public String getOpenId() {
		return openId;
	}
	public void setOpenId(String openId) {
		this.openId = openId;
	}
	public String getCheckName() {
		return checkName;
	}
	public void setCheckName(String checkName) {
		this.checkName = checkName;
	}
	public int getAmount() {
		return amount;
	}
	public void setAmount(int amount) {
		this.amount = amount;
	}
	public String getDesc() {
		return desc;
	}
	public void setDesc(String desc) {
		this.desc = desc;
	}
	public String getSpbillCreateIp() {
		return spbillCreateIp;
	}
	public void setSpbillCreateIp(String spbillCreateIp) {
		this.spbillCreateIp = spbillCreateIp;
	}
	
	
}
